home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SCI Games E3 2005 Press Kit (USA)
/
SCI Games E3 2005 Press Kit (USA).bin
/
runme_mac.swf
/
scripts
/
__Packages
/
mx
/
controls
/
streamingmedia
/
VolumeControlHandle.as
< prev
Wrap
Text File
|
2005-05-05
|
2KB
|
106 lines
class mx.controls.streamingmedia.VolumeControlHandle extends MovieClip
{
function VolumeControlHandle()
{
super();
this.init();
}
function init()
{
this._volumeControl = this._parent;
this._controller = this._parent._parent;
this.setVolume(this._controller.__get__volume());
this.__set__enabled(this._controller.enabled);
this.tabEnabled = false;
this.tabChildren = false;
}
function isVertical()
{
return !this._controller.__get__horizontal();
}
function setVolume(aVolume)
{
if(aVolume < 0)
{
aVolume = 0;
}
else if(aVolume > 100)
{
aVolume = 100;
}
this._x = this.volumeToX(aVolume);
}
function setMute()
{
this.setVolume(0);
}
function setLoud()
{
this.setVolume(100);
}
function handlePress()
{
this.startThumbDrag();
}
function handleRelease()
{
this.stopThumbDrag();
}
function handleReleaseOutside()
{
this.stopThumbDrag();
}
function startThumbDrag()
{
this.startDrag(false,12,3,12 + this.getRange(),3);
this.onMouseMove = this.handleMouseMove;
}
function stopThumbDrag()
{
this.stopDrag();
delete this.onMouseMove;
this.broadcastEvent();
}
function handleMouseMove()
{
this.broadcastEvent();
}
function broadcastEvent()
{
this._controller.broadcastEvent("volume",this.xToVolume(this._x));
}
function xToVolume(x)
{
return (x - 12) * (100 / this.getRange());
}
function volumeToX(aVol)
{
return aVol / (100 / this.getRange()) + 12;
}
function getRange()
{
var _loc2_ = !this.isVertical() ? 50 : 27;
return _loc2_;
}
function get enabled()
{
return this._enabled;
}
function set enabled(is)
{
this._enabled = is;
if(is)
{
this.onPress = this.handlePress;
this.onRelease = this.handleRelease;
this.onReleaseOutside = this.handleReleaseOutside;
}
else
{
delete this.onPress;
delete this.onRelease;
delete this.onReleaseOutside;
}
}
}